<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>邮件发送</title>
    <script src="js/jquery-3.3.1.min.js"></script>
</head>
<body>
邮件:<input type="text" id="mail"> <button onclick="sendMail()">发送</button> <br>
验证码:<input type="text" id="code"> <br>
<button>验证</button>
</body>

</html>

<script>
    function  sendMail() {
        var m = $("#mail").val();
        $.get('/api/sendMail',{toMail:m},function (res) {
            alert('发送成功');
        });

    }
</script>